package com.lesserpand.rabbitmq.netty.controller;

import com.lesserpand.rabbitmq.netty.listener.NettyServer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author bailuo
 * @version 2.0
 * @Description TODO
 * @Date Created in 2019/1/23 15:57
 */
@RestController
@RequestMapping("/netty-server")
public class NettyController {

    private static final Logger LOGGER = LoggerFactory.getLogger(NettyController.class);

    @Autowired
    private NettyServer nettyServer;

    @PostMapping(value = "", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
    public String sendMeg(String msg) {
        String returnStr = nettyServer.sent(msg);
        return returnStr;
    }
}
